package com.cy1;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Set;

public class GenericDemo {
    public static void main(String[] args) {
//        Collection c = new ArrayList();
        Collection<String> c = new ArrayList<>();
        c.add("chenyongdelaoposhiyuanxiang");
//        c.add(25);
//        Iterator iterator = c.iterator();
        Iterator<String> iterator = c.iterator();
        while (iterator.hasNext()){
            String s = iterator.next();
            System.out.println(s);
        }

//        for (Object o : c) {
//            System.out.println(o);
//        }

    }
}
